var Alert = function(){
	
	var result ={
		StayOpen:false,
		Show:function($parent,width,height,title,url,success){
			$parent.append($('<div class="ppm-erp-mask"></div>')); //添加遮罩层
			var $alert = $('<div class="ppm-erp-alert" style="width:'+width+'px;height:'+height+'px"></div>'); //弹出框
			
			var $title = $('<div class="ppm-erp-alert-title"></div>');
			$title.append($('<span></span>').html(title));
			$title.append($('<img src="img/close.png" />'));
			var $frame = $('<iframe id="WidownFrame" style="height:'+(height - 90)+'px" src="'+url+'"></iframe>');
			$btnRect = $('<div class="ppm-erp-alert-btnRect"></div>');
			$btnRect.append($('<a class="ppm-erp-alert-btn ppm-erp-alert-cancelbtn">取消</a>'));
			$btnRect.append($('<a class="ppm-erp-alert-btn ppm-erp-alert-okbtn">确定</a>'));
			//添加子元素
			$alert.append($title);
			$alert.append($frame);
			$alert.append($btnRect);
			$parent.append($alert).fadeIn(2000);
			var self = this;
			//淡入淡出
			$alert.fadeIn(500);
			//绑定关闭
			$title.find("img").click(function(){
				$parent.find(".ppm-erp-mask").remove();
				$parent.find($alert).remove();
			});
			$btnRect.find(".ppm-erp-alert-cancelbtn").click(function(){
				$parent.find(".ppm-erp-mask").remove();
				$parent.find($alert).remove();
			});
			$btnRect.find(".ppm-erp-alert-okbtn").click(function(){
				
				if(typeof(success)=='function'){
					stayOpen = success($frame.contents());
				}
				if(!self.StayOpen){
				//关闭
					$parent.find(".ppm-erp-mask").remove();
					$parent.find($alert).remove();
				}
			});
		}
	};
	return result;
}
